{{define "auth/signin.html"}}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>教师管理 | Log in</title>
{{template "auth/auth_start.html" .}}
<body class="hold-transition login-page">
<div class="login-box full-page">
    <div class="login-logo">
        <a href="/"><b>T</b>eacherManager</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
    {{if not .message}}
        <p class="login-box-msg">Sign in to start your session</p>
    {{else}}
        <p class="login-box-msg text-danger">{{.message}}</p>
    {{end}}

        <form action="/signin" method="post">
            <input type="hidden" name="_csrf" value="{{.csrf}}">
            <input type="hidden" class="rem" name="remember" value="false">
            <div class="form-group has-feedback">
                <input type="email" name="username" class="form-control" placeholder="Email">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" name="password" class="form-control" placeholder="Password">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">
                    <div class="checkbox icheck">
                        <label>
                            <input type="checkbox" name="checkbox"> Remember Me
                        </label>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
                </div>
                <!-- /.col -->
            </div>
        </form>


        <!-- /.social-auth-links -->

        <a href="#">I forgot my password</a><br>
        <a href="/signup" class="text-center">Register a new membership</a>

    </div>
    <!-- /.login-box-body -->
    <div class="full-page-background" style="background-image: url(/static/images/login.jpeg) "></div>
</div>

<!-- /.login-box -->

<!-- jQuery 3 -->
<script src="/static/libs/jquery/jquery.min.js"></script>
<script src="/static/libs/jquery/jquery.cookie.js"></script>
<script src="/static/libs/jquery/jquery.base64.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="/static/libs/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="/static/libs/iCheck/icheck.min.js"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        }).on('ifChecked', function (event) {
            $(".rem").val("true")
        }).on('ifDisabled', function (event) {
            $(".rem").val("false")
        });
        if (typeof ($.cookie('uname')) !== "undefined") {
            $("input[name='username']").val($.cookie('uname'))
        }
        if (typeof ($.cookie('rem')) !== "undefined") {
            $('input').iCheck('check');
        }
        if (typeof ($.cookie('pwd')) !== "undefined") {
            var pwd = $.base64.decode($.cookie('pwd'));
            var truepwd = pwd.substring(0,pwd.length-5);
            // console.log(truepwd);
            $("input[name='password']").val(truepwd)
        }

    });
</script>
</body>
</html>
{{end}}